package app.caretrack.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "AlarmNotificationPlans")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class AlarmNotificationPlan extends NamedBaseModel {

    private List<Machine> machineList;

    private List<AlarmNotification> notificationList;

    @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
    @JoinTable(name = "NotificationPlans_Machines", inverseJoinColumns = @JoinColumn(name = "Machines"), joinColumns = @JoinColumn(name = "NotificationPlans"))
    public List<Machine> getMachineList() {
        return this.machineList;
    }

    public void setMachineList(List<Machine> machineList) {
        this.machineList = machineList;
    }

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH, mappedBy = "notificationPlan")
    public List<AlarmNotification> getNotificationList() {
        return this.notificationList;
    }

    public void setNotificationList(List<AlarmNotification> notificationList) {
        this.notificationList = notificationList;
    }

}
